$(() => {
	var backTop = $('.back-top');
	// 判断滚动条高度
	$(window).on('scroll', () => {
		let winTop = $(window).scrollTop();
			if (winTop > 500) {
				backTop.addClass('back-animation')
			} else {
				backTop.removeClass('back-animation')
			}
		backTop.on('click', () => {
			if ($(window).scrollTop() > 0) {
         		$("html,body").stop().animate({ scrollTop: 0 }, 1000);
        	}
		})
	})

	// 移入返回顶部按钮
	backTop.on('mouseover', () => {
		backTop.css({
			background: '#364d77'
		});
	})

	// 移出返回顶部按钮
	backTop.on('mouseleave', () => {
		backTop.css({
			background: '#2272FF'
		});
	})
})
